package com.glb.app.tools;

import dev.langchain4j.agent.tool.P;
import dev.langchain4j.agent.tool.Tool;
import dev.langchain4j.agent.tool.ToolMemoryId;
import org.springframework.stereotype.Component;

@Component
public class CalculatorTools {

    @Tool(name = "add",value = "加法")
    public Double  sum(
            @ToolMemoryId Long memoryId,
            @P(value = "加数1",required = true) double a,
                       @P(value = "加数1",required = true)double b) {
        System.out.println(memoryId);
        return a + b;

    }
    @Tool
    public Double  sub(double a, double b) {
        return a - b;
    }
    @Tool
    public Double  mul(double a, double b) {
        return a * b;
    }
    public Double  div(double a, double b) {
        return a / b;
    }
    @Tool
    public Double  pow(double a, double b) {
        return Math.pow(a, b);
    }
    @Tool
    public Double  sqrt(double a) {
        return Math.sqrt(a);
    }
    @Tool
    public Double  log(double a) {
        return Math.log(a);
    }

    @Tool
    public Double  sin(double a) {
        return Math.sin(a);
    }

    @Tool
    public Double  cos(double a) {
        return Math.cos(a);

    }
    @Tool
    public Double  tan(double a) {
        return Math.tan(a);
    }
    @Tool
    public Double  asin(double a) {
        return Math.asin(a);
    }
}


